<template>
  <div class="photoinfo">
    <h3>{{photoinfo.title}}</h3>
    <p class="subtitle">
      <span>发表时间:{{photoinfo.add_time | format("YYYY-MM-DD HH:mm:ss")}}</span>
      <span>评论次数:{{photoinfo.click}}次</span>
    </p>
    <hr>

    <!-- 缩略图 -->
    <!-- 缩略图区域 -->
    <!-- <div class="thumbs">
          <img class="preview-img" v-for="(item, index) in list" :src="item.src" height="100" @click="$preview.open(index, list)" :key="item.src">
    </div>-->
    <!-- <div id="thumbs">
      <vue-preview :slides="list" @close="handleClose"></vue-preview>
    </div> -->

    <!-- 图片内容区域 -->
    <div class="content" v-html="photoinfo.content"></div>
    <!--放置一个现成的子组件  -->
    <cmt-box :id="id"></cmt-box>
  </div>
</template>

<script>
import { getPhotoInfo } from "@/api";
import comment from "@/components/subcomponents/comment.vue";
export default {
  data() {
    return {
      id: this.$route.params.id,
      photoinfo: {},
      list: [] //缩略图数组
    };
  },
  created() {
    this.init();
  },
  methods: {
    // handleClose() {},
    init() {
      getPhotoInfo(this.id).then(res => {
        this.photoinfo = res.data.message[0];
      });
    }
  },
  components:{
      'cmt-box':comment
  }
};
</script>

<style lang="less" scoped>
.photoinfo {
  padding: 3px;
  h3 {
    color: #26a2ff;
    font-size: 15px;
    text-align: center;
    margin: 15px 0;
  }
  .subtitle {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
  }
  .content {
    font-size: 13px;
    line-height: 30px;
  }

  /deep/#thumbs .my-gallery {
    overflow: hidden;
    figure {
      padding: 5px;
      width: 100px;
      float: left;
      margin: 0;
      a {
        width: 100%;
        display: block;
      }
      img {
        width: 100%;
        display: block;
        height: 60px;
      }
    }
  }
}
</style>